package university.dropcourse.resource;

import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.persistence.EntityExistsException;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import university.dropcourse.dto.DocenteDto;
import university.dropcourse.dto.StudenteDto;
import university.dropcourse.service.RegistrationManagerBean;


@Stateless
@Path(value="registration")
public class RegistrationManagerDelegator {

    @EJB
    RegistrationManagerBean registrationBean;


    public RegistrationManagerDelegator() { }


    @POST
    @Path("registraDocente")
    @Consumes(MediaType.APPLICATION_XML)
    @Produces(MediaType.APPLICATION_XML)
    public void registraDocente(DocenteDto doc) throws EntityExistsException{
    	
    	registrationBean.registraDocente(doc);
        
    }
    
    @POST
    @Path("registraStudente")
    @Consumes(MediaType.APPLICATION_XML)
    @Produces(MediaType.APPLICATION_XML)
    public void registraStudente(StudenteDto stud) {
    	
    	registrationBean.registraStudente(stud);    
    	
    }
}